package test1230pm;



class ChangFangXing {


    int chang;

    int kuan;

    public ChangFangXing() {
    }

    public void ChangFangXing(int chang, int kuan) {
        this.chang = chang;
        this.kuan = kuan;
    }

    public int getChang() {
        return chang;
    }

    public void setChang(int chang) {
        this.chang = chang;
    }

    public int getKuan() {
        return kuan;
    }

    public void setKuan(int kuan) {
        this.kuan = kuan;
    }

    @Override
    public String toString() {
        return "ChangFangXing{" +
                "chang=" + chang +
                ", kuan=" + kuan +
                '}';
    }

    // 周长
    public int m1() {
        return (chang + kuan) * 2;
    }

    // 面积
    public int m2() {
        return chang * kuan;
    }

    public static void main(String[] args) {

        // (1)设计一个长方形类
        // 属性：长、宽
        // 功能：周长、面积
        // 要求：分别创建3个不同的对象、求周长、求面积
        ChangFangXing a=new ChangFangXing();
        a.setChang(5);
        a.setKuan(5);
        int x=a.m1();
        System.out.println(x);
        int y=a.m2();
        System.out.println(y);

        ChangFangXing b=new ChangFangXing();
        System.out.println(b.m1());
        System.out.println(b.m2());

    }

}